﻿Imports System
Imports System.Drawing

Namespace System.Workflow.ComponentModel.Design
    Public NotInheritable Class ShadowGlyph
        Inherits DesignerGlyph
        ' Methods
        Public Overrides Function GetBounds(ByVal designer As ActivityDesigner, ByVal activated As Boolean) As Rectangle
            If (designer Is Nothing) Then
                Throw New ArgumentNullException("designer")
            End If
            Dim bounds As Rectangle = designer.Bounds
            bounds.Inflate(5, 5)
            Return bounds
        End Function

        Protected Overrides Sub OnPaint(ByVal graphics As Graphics, ByVal activated As Boolean, ByVal ambientTheme As AmbientTheme, ByVal designer As ActivityDesigner)
            If Not Me.GetBounds(designer, activated).Size.IsEmpty Then
                Dim roundEdges As Boolean = ((designer.DesignerTheme.DesignerGeometry = DesignerGeometry.RoundedRectangle) AndAlso Not designer.IsRootDesigner)
                ActivityDesignerPaint.DrawDropShadow(graphics, designer.Bounds, designer.DesignerTheme.BorderPen.Color, 4, (LightSourcePosition.Top Or LightSourcePosition.Left), 0.5!, roundEdges)
            End If
        End Sub


        ' Properties
        Friend Shared ReadOnly Property [Default] As ShadowGlyph
            Get
                If (ShadowGlyph.defaultShadowGlyph Is Nothing) Then
                    ShadowGlyph.defaultShadowGlyph = New ShadowGlyph
                End If
                Return ShadowGlyph.defaultShadowGlyph
            End Get
        End Property

        Public Overrides ReadOnly Property Priority As Integer
            Get
                Return &HF4240
            End Get
        End Property


        ' Fields
        Private Shared defaultShadowGlyph As ShadowGlyph
    End Class
End Namespace

